package com.stefan.lession06;

import javax.swing.*;
import java.awt.*;
import java.util.Vector;

public class TestComboboxDemo02 extends JFrame {

    public TestComboboxDemo02() {
        Container container = this.getContentPane();

        // 生成列表的内容
//        String[] contents = {"1","2","3"};

        Vector<Object> contents = new Vector<>();

        // 列表中需要放入内容
        JList<Object> jList = new JList<>(contents);

        contents.add("1");
        contents.add("2");
        contents.add("3");

        container.add(jList);

        this.setVisible(true);
        this.setSize(500,400);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        new TestComboboxDemo02();
    }
}
